<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<style>
    .profile-header {
        margin-bottom: 30px;
    }
    
    .profile-title {
        font-size: 28px;
        font-weight: 600;
        color: #1a1a1a;
        margin-bottom: 8px;
    }
    
    .profile-subtitle {
        color: #666;
        font-size: 16px;
    }
    
    .profile-card {
        background: white;
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        padding: 40px;
        max-width: 500px;
        position: relative;
        overflow: hidden;
        border: 1px solid #e5e5e5;
    }
    
    .profile-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: #333;
    }
    
    .form-group {
        margin-bottom: 24px;
    }
    
    .form-group label {
        display: block;
        margin-bottom: 8px;
        color: #1a1a1a;
        font-weight: 600;
        font-size: 14px;
    }
    
    .form-group input {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e5e5e5;
        border-radius: 10px;
        font-size: 16px;
        transition: all 0.3s ease;
        background: #fafafa;
        color: #1a1a1a;
    }
    
    .form-group input:focus {
        outline: none;
        border-color: #333;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
    }
    
    .form-group input[readonly] {
        background: #f1f3f4;
        color: #666;
        cursor: not-allowed;
    }
    
    .save-btn {
        background: #1a1a1a;
        color: white;
        padding: 12px 32px;
        border: none;
        border-radius: 10px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        margin-top: 16px;
    }
    
    .save-btn:hover {
        background: #333;
        transform: translateY(-1px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    }
    
    .profile-actions {
        margin-top: 32px;
        padding-top: 24px;
        border-top: 1px solid #e5e5e5;
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
    }
    
    .action-btn {
        padding: 8px 16px;
        border-radius: 8px;
        text-decoration: none;
        font-weight: 500;
        transition: all 0.3s ease;
        font-size: 14px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    
    .action-btn.primary {
        background: #1a1a1a;
        color: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .action-btn.primary:hover {
        background: #333;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .action-btn.danger {
        background: #d32f2f;
        color: white;
        box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
    }
    
    .action-btn.danger:hover {
        background: #b71c1c;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(211, 47, 47, 0.4);
    }
    
    .message {
        padding: 12px 16px;
        border-radius: 8px;
        margin-bottom: 20px;
        font-size: 14px;
        font-weight: 500;
    }
    
    .message.success {
        background: #e8f5e8;
        color: #2e7d32;
        border-left: 4px solid #4caf50;
    }
    
    .message.error {
        background: #ffebee;
        color: #c62828;
        border-left: 4px solid #f44336;
    }
    
    .user-avatar {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        background: #1a1a1a;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 32px;
        font-weight: bold;
        margin: 0 auto 24px;
    }
</style>

<div class="profile-header">
    <div class="profile-title">个人资料</div>
    <div class="profile-subtitle">管理您的账户信息</div>
</div>

<div class="profile-card">
    <div class="user-avatar">
        ${fn:substring(user.username, 0, 1)}
    </div>
    
    <c:if test="${not empty msg}">
        <div class="message success">${msg}</div>
    </c:if>
    <c:if test="${not empty error}">
        <div class="message error">${error}</div>
    </c:if>
    
    <form action="/user/profile" method="post">
        <div class="form-group">
            <label for="username">用户名</label>
            <input type="text" id="username" name="username" value="${user.username}" readonly>
        </div>
        
        <div class="form-group">
            <label for="email">邮箱地址</label>
            <input type="email" id="email" name="email" value="${user.email}" placeholder="请输入邮箱地址">
        </div>
        
        <button type="submit" class="save-btn">
            <span>💾</span>
            保存修改
        </button>
    </form>
    
    <div class="profile-actions">
        <a href="/user/changePassword" class="action-btn primary">
            <span>🔒</span>
            修改密码
        </a>
        <a href="/user/logout" class="action-btn danger">
            <span>🚪</span>
            退出登录
        </a>
    </div>
</div> 